import requests

from common.get_token import get_token_ihrm

class IhrmEmpApi:
    @classmethod
    def app_api(cls,token,data_json):
        resp = requests.post(url="http://ihrm-test.itheima.net/api/sys/user",
                             headers={"Authorization": token},
                             json=data_json)
        return resp
    @classmethod
    def put_api(cls,id,token,data_json):
        resp = requests.put(url="http://ihrm-test.itheima.net/api/sys/user/" + id,
                            headers={"Authorization": token},
                            json=data_json)
        return resp
    @classmethod
    def get_api(cls,id,token):
        resp = requests.get(url="http://ihrm-test.itheima.net/api/sys/user/" + id,
                            headers={"Authorization": token})
        return resp

    @classmethod
    def detlet_api(cls, id, tokrn):
        resp = requests.delete(url="http://ihrm-test.itheima.net/api/sys/user/" + id,
                            headers={"Authorization": token})
        return resp
if __name__ == '__main__':
    emp_id='1524645585548804096'
    token=get_token_ihrm()
    resp=IhrmEmpApi.get_api(emp_id,token)
    print("查询员工",resp.json())








